// log 日志
const LGLog = {
  capsule: (title: string, text: string, type?: string) => {
    console.log(`%c ${title} %c ${text} %c`, 'background:#35495E; padding: 2px ; border-radius: 3px 0 0 3px; color: #fff;', `background:${typeColor(type)}; padding: 2px; border-radius: 0 3px 3px 0;  color: #fff;`, 'background:transparent')
  },
  error: (info: string) => {
    console.group('error info')
    console.log('msg: ', info)
    console.groupEnd()
  },
}

const typeColor = (type = 'primary'): string => {
  let color: string = ''
  switch (type) {
    case 'primary':
      color = '#1890ff'
      break
    case 'success':
      color = '#52c41a'
      break
    case 'warning':
      color = '#faad14'
      break
    case 'error':
      color = '#ff4d4f'
      break
    default:
      break
  }
  return color
}

export default LGLog
